﻿<h3>TestBootstrapChartBar</h3>
<Chart ChartType="ChartType.Bar" OnInitAsync="() => OnInitBarColorSeparately(true)" Title="BarColorSeparately Demo" Height="300px" />
@code {

    private Random Randomer { get; } = new Random();
    private int BarDataCount { get; set; } = 7;

    private Task<ChartDataSource> OnInitBarColorSeparately(bool barColorSeparately)
    {
        var ds = new ChartDataSource();
        ds.Options.Title = "Bar color separately";
        ds.Options.ShowLegend = false;
        ds.Options.BarColorSeparately = barColorSeparately;
        ds.Options.X.Title = "days";
        ds.Options.Y.Title = "Numerical value";
        ds.Labels = Enumerable.Range(1, BarDataCount).Select(i => i.ToString());
        ds.Data.Add(new ChartDataset()
            {
                Label = $"Set {0}",
                Data = Enumerable.Range(1, BarDataCount).Select(i => Randomer.Next(20, 37)).Cast<object>(),
                BackgroundColor =new [] {"rgb(54, 162, 235, 0.5)", "rgb(75, 192, 192, 0.5)", "rgb(255, 99, 132, 0.5)", "rgb(255, 159, 64, 0.5)", "rgb(255, 205, 86, 0.5)", "rgb(255, 99, 71, 0.5)", "rgb(255, 192, 203, 0.5)"},
                BorderColor =new[] { "rgb(54, 162, 235)", "rgb(75, 192, 192)", "rgb(255, 99, 132)", "rgb(255, 159, 64)", "rgb(255, 205, 86)", "rgb(255, 99, 71)", "rgb(255, 192, 203)"}
            });
        return Task.FromResult(ds);
    }
}
